import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';

export const useFormatText = (isFormat?: boolean) => {
  const { t } = useTranslation();

  const formatText = useCallback(
    (text: string, key: string, isInnerFormat: boolean = false) => {
      console.warn(key);
      if (isFormat || isInnerFormat) {
        return t(text);
      }
      return text;
    },
    [t, isFormat]
  );

  return { formatText };
};
